//
//  NewsDetails.m
//  news
//
//  Created by lanou on 15/12/17.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "NewsDetails.h"

@implementation NewsDetails

- (NSMutableArray *)img
{
    if (!_img) {
        _img = [[NSMutableArray alloc] init];
    }
    return _img;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

+ (instancetype)detailWithDict:(NSDictionary *)dict {
    NewsDetails *model = [[NewsDetails alloc] init];
    [model setValuesForKeysWithDictionary:dict];
    
    NSMutableArray *imgArray = [NSMutableArray array];
    for (NSDictionary *dict in model.img) {
        NewsDetailsImg *imgModel = [NewsDetailsImg detailWithDict:dict];
        [imgArray addObject:imgModel];
    }
    model.img = imgArray;
    
    NSMutableArray *videoArray = [NSMutableArray array];
    for (NSDictionary *videoDict in model.video) {
        NewsDetailsVideo *videoModel = [NewsDetailsVideo detailWithDict:videoDict];
        [videoArray addObject:videoModel];
    }
    model.video = videoArray;
    
    NSMutableArray *relativeArray = [NSMutableArray array];
    for (NSDictionary *relativeDic in model.relative_sys) {
        NewsDetailsRelative *relativeModel = [NewsDetailsRelative detailWithDict:relativeDic];
        [relativeArray addObject:relativeModel];
    }
    model.relative_sys = relativeArray;
    
    NSMutableArray *relativeArray2 = [NSMutableArray array];
    for (NSDictionary *relativeDic in model.relative) {
        NewsDetailsRelative *relativeModel = [NewsDetailsRelative detailWithDict:relativeDic];
        [relativeArray2 addObject:relativeModel];
    }
    model.relative = relativeArray2;
    
    return model;
}


@end
